package com.sghj.pageviews.controller;

import com.sghj.config.ReturnResult;
import com.sghj.pageviews.entity.PageView;
import com.sghj.pageviews.service.SysAccessLogService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description: 访问统计接口类
 * @author: zhongkai
 * @create: 2022-03-01 17:15
 **/

@RestController
@RequestMapping("/pageviews")
public class SysAccessLogController {
    //初始化log
    private final static Logger log = org.slf4j.LoggerFactory.getLogger(SysAccessLogController.class);

    @Autowired
    private SysAccessLogService sysLogService;

    @ApiOperation(value = "获取访问量信息")
    @GetMapping("getpageviews")
    public ReturnResult getpageviews(){

        PageView viewResult = sysLogService.getViewResult();
        return ReturnResult.success().data("viewResult",viewResult);
    }
}
